<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-on</title>
</head>

<body>
    <script src="../js/vue.js"></script>

    <div id="root">
        <input type="button" value="v-on指令" v-on:click="doIt">
        <input type="button" value="v-on简写" @click="doIt">
        <input type="button" value="双击事件" @dblclick="doIt">
        <span @click="changeFood">{{food}}</span>
    </div>

    <script>
        var root = new Vue({
            el: "#root",
            data: {
                food: "王者荣耀"
            },
            methods: {
                doIt: function () {
                    alert("做IT");
                },
                changeFood: function () {
                    // console.log(this.food)
                    this.food+= "好好玩！"
                }

            }
        })
    </script>
</body>

</html>